﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace caculate
{
    public partial class NewUser : Form
    {
        public NewUser()
        {
            InitializeComponent();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        public class NEW
        {
            public static NewParent frm_newprt;
            public static NewChildren frm_newchd;
        }

        private void NewUser_Load(object sender, EventArgs e)
        {
            comboBox1.Items.Add("家长用户注册");
            comboBox1.Items.Add("学生用户注册");
            NEW.frm_newprt = new NewParent() { TopLevel = false, FormBorderStyle = FormBorderStyle.None };
            NEW.frm_newchd = new NewChildren() { TopLevel = false, FormBorderStyle = FormBorderStyle.None };
        }

        private void ChooseCharacter_Click(object sender, EventArgs e)
        {
            if(comboBox1.Text!="")
            {
                switch (comboBox1.SelectedItem.ToString())
                {
                    case "家长用户注册":
                        {
                            this.panel1.Controls.Clear();
                            //NewParent frm_newprt = new NewParent(){ TopLevel = false, FormBorderStyle = FormBorderStyle.None };
                            this.panel1.Controls.Add(NEW.frm_newprt);
                            NEW.frm_newprt.Show();
                        }
                        break;
                    case "学生用户注册":
                        {
                            this.panel1.Controls.Clear();
                            //NewChildren frm_newchd= new NewChildren() { TopLevel = false, FormBorderStyle = FormBorderStyle.None };
                            this.panel1.Controls.Add(NEW.frm_newchd);
                            NEW.frm_newchd.Show();
                        }
                        break;
                }
            }
        }

        private void NewUser_FormClosed(object sender, FormClosedEventArgs e)
        {
            Form1 frm1;
            frm1 = (Form1)this.Owner;
            frm1.Show();
            this.Close();
        }

        private void backward_Click(object sender, EventArgs e)
        {
            Form1 frm1;
            frm1 = (Form1)this.Owner;
            frm1.Show();
            this.Close();
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }
    }
}
